<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=s, initial-scale=1.0" />
    <title>Document</title>
  </head>
  <body>
    <script>
      // async function fn(){
      //   // return 123;
      //   return () => {

      //   }
      // }
      // console.log(fn());

      async function fn() {
        let p = new Promise((resolve, reject) => {
          // console.log(222);
          // setTimeout(() => {
          //   resolve('ok');
          // }, 3000)
          reject("456789");
        });

        try {
          // await 异步等待
          let res = await p;
          //处理成功的结果值
          //这里相当于是 promise 对象 then 方法成功的回调
        } catch (reason) {
          //处理失败的结果值
          //这里相当于是 promise 对象 then 方法失败的回调
          console.error(reason);
        }
      }
      fn();

    </script>
  </body>
</html>
